// pattern
export const IP =
  /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;

export const IP_PORT = /^\d{1,5}$/;

// ^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])+(\.[a-zA-Z]{2,5})$
export const DOMAIN =
  /^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])(\.[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])+(\.[a-zA-Z]{2,5})$/;

// export const ID_CARD = /^[1-9]\d{5}[1-9]\d{3}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\d{3}(\d|x|X)$/;
export const ID_CARD = /^(\d{6})(\d{4})(\d{2})(\d{2})(\d{3})([0-9]|X)$/;

// 常规的日期
export const Date = /^(19|20)\d{2}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$/;

// 正数
export const POSITIVE_NUMBER = /^[+]?[0-9]*\.?[0-9]+$/;

// 非零正整数
export const POSITIVE_INTEGER = /^[1-9][0-9]*$/;

export const EMIAL =
  /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;

export const ALPHABETS = /^[A-Za-z]+$/;

export const LOWERCASE = /^[a-z]+$/;

export const UPPERCASE = /^[A-Z]+$/;

export const URL =
  /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/;

export const ALPHABETS_CHARACTER = /^[a-zA-Z\u4e00-\u9fa5]+$/;

export const ALPHABETS_CHARACTER_NUMBER = /^[a-zA-Z\u4e00-\u9fa50-9]+$/;

export const ALPHABETS_NUMBER = /^[a-zA-Z0-9]+$/;

export const CHARACTER = /^[\u4e00-\u9fa5]+$/;

export const NUMBER = /^[0-9]+$/;

// 至少要有数字和英文
export const ALPHABETS_NUMBER_MUST = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6}$/;

// 只能输入中英文
export const ALPHABETS_CHARACTER_ONLY = /^[a-zA-Z\u4e00-\u9fa5]+$/;

/*
  经度范围：-180.0000~180.0000;
  纬度范围：-90.0000~90.0000
*/
// 经度
// export const LONGITUDE = /^-?((0|1?[0-7]?[0-9]?)(([.][0-9]{1,4})?)|180(([.][0]{1,4})?))$/;
export const LONGITUDE = /^[-+]?[0-9]{1,3}(\.[0-9]{1,6})?$/;

// 纬度
// export const LATITUDE = /^-?((0|[1-8]?[0-9]?)(([.][0-9]{1,4})?)|90(([.][0]{1,4})?))$/;
export const LATITUDE = /^[-+]?([0-8]?[0-9]|90)(\.[0-9]{1,6})?$/;

// 验证手机号
// export const PHONE = /^1[345678]\d{9}$/;
export const PHONE = /^1[3-9]\d{9}$/;

// 验证图片
export const IMAGE = /\.(png|jpg|gif|jpeg|webp)$/;

// 只能包含英文、数字和特殊字符
export const ALPHABETS_NUMBER_SPECIAL_ONLY =
  /^[0-9a-zA-Z\d`~!@#$%^&*()_\-+=<>?:"{}|,./;'\\[\]·~！@#￥%……&*（）——\-+={}|《》？：“”【】、；‘'，。、]+$/;

// export const reg = /^[a-zA-Z\u4e00-\u9fa5]+$/;
// export const len = value.replace(/[\u4e00-\u9fa5]/g, 'xx').length

// 正实数
export const MORETHAN_ZERO = /^[1-9]+\d*(\.\d*)?$|^0?\.\d*[1-9]\d*$/;

// 设备SN号 可以是任意的字符串，但通常由数字和字母组成
export const SN = /^[A-Za-z0-9]+$/;

export const CREDIT_CODE = /^([a-zA-Z0-9]{15,18})$/;

export const AREA_CODE = /^\d{12}$/;

// export const LICENSE_PLATE = /^[\u4e00-\u9fa5][A-Z][A-Z_0-9]{5,6}$/;
export const LICENSE_PLATE =
  /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z][A-Z][A-Z0-9]{4}[A-Z0-9挂学警港澳]$/;
